<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div>
        <p class="p1">p1标签</p>
        <p class="p2">p2标签</p>
        <p class="p3">p3标签</p>
    </div>
</body>
<script>
     let element = document.createElement('h3');
     element.innerHTML = "新增节点h3";
     let div = document.querySelector('div');
     div.appendChild(element);
     let newnode = document.createElement('p');
     newnode.innerHTML = "新增节点p"
     //插入到p1之前
     div.insertBefore(newnode,document.querySelector('.p1'));
     div.insertBefore(newnode,document.querySelector('.p3'));
     div.insertBefore(newnode,document.querySelector('.p2'));
     element.innerHTML = "I am modifying h3";
    //  div.insertBefore(newnode,null);
</script>
</html>